Shared virtual memory

ABSTRACT

A method and system for shared virtual memory between a central processing unit (CPU) and a graphics processing unit (GPU) of a computing device are disclosed herein. The method includes allocating a surface within a system memory. A CPU virtual address space may be created, and the surface may be mapped to the CPU virtual address space within a CPU page table. The method also includes creating a GPU virtual address space equivalent to the CPU virtual address space, mapping the surface to the GPU virtual address space within a GPU page table, and pinning the surface.

TECHNICAL FIELD

The present invention relates generally to the shared virtual memorybetween a central processing unit (CPU) and a graphics processing unit(GPU) within a computing system. More specifically, the presentinvention relates to the sharing of virtual memory between a CPU and aGPU.

BACKGROUND ART

Modern I/O devices may include computer processing capabilities thatrival the computer processing capabilities of many CPUs. As a result, aportion of the computational tasks traditionally performed by the CPUmay be offloaded to an I/O device like a GPU of a computing device,thereby increasing the efficiency of the CPU.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a computing device that may be used inaccordance with embodiments;

FIGS. 2A and 2B are a schematic of a unified memory architecture (UMA)that may be used to implement a procedure for shared virtual memory, inaccordance with embodiments;

FIG. 3 is a process flow diagram showing a method for shared virtualmemory, in accordance with embodiments;

FIG. 4 is a process flow diagram showing a method for processing sharedvirtual memory, in accordance with embodiments;

FIG. 5 is a block diagram showing tangible, non-transitory,computer-readable media that store code for shared virtual memory, inaccordance with embodiments;

FIG. 6 is a block diagram of an exemplary system for implementing sharedphysical memory; and

FIG. 7 is a schematic of a form factor device in which the system ofFIG. 6 may be embodied.

The same numbers are used throughout the disclosure and the figures toreference like components and features. Numbers in the 100 series referto features originally found in FIG. 1; numbers in the 200 series referto features originally found in FIG. 2; and so on.

DESCRIPTION OF THE EMBODIMENTS

Current operating systems and graphics interfaces manage CPUs as I/Odevices, rather than managing the CPUs as processors similar to CPUs. Bymanaging GPUs as I/O devices, CPUs and GPUs have physical memories withseparate physical address domains and separate virtual addressingschemes. When offloading computational tasks to the GPUs, data is copiedfrom the physical address domain of the CPU to the physical addressdomain of the GPU. The GPU may restructure the data or configure thecompiler to traverse the data structure. Additionally, the GPU may useits own virtual addressing scheme to access the copied data.

By offloading a portion of the computational tasks traditionallyperformed by the CPU of a computing device to the GPU of a computingdevice, the efficiency of the CPU may be increased. In order to offloadtasks to the GPU, data may be transferred between the physical memory ofthe CPU to the physical memory of the GPU. The data may be structuredusing techniques suited for the CPU, such as trees and linked lists.Trees and linked lists are pointer based data structures where the CPUtraverses the tree or linked list using pointers at various nodes. Forexample, a linked list is a data structure that includes a group ofnodes. Each node contains two fields, an integer value and a link to thenext node in the list. The last node is linked to a terminator thatsignifies the end of the list.

In order to traverse the linked list, the GPU typically restructures thedata or configures the GPU compiler to traverse the list. The GPU mayalso engage in pointer chasing through the pointer based structure inorder to access the data after it is copied to the GPU memory. Pointerchasing refers to the process of traversing many levels of pointers inorder to access a desired pointer. The data restructuring, compilerconfiguration, and pointer chasing that occurs when offloadingcomputational tasks to the GPU may reduce any efficiency gained byoffloading tasks to the GPU. Accordingly, embodiments described hereinrelate to the sharing of virtual memory between the CPU and the GPU of acomputing device. The virtual memory may be shared without restructuringthe data, configuring the GPU compiler to consume data, or pointerchasing.

In various embodiments, the UMA provides for shared virtual memorybetween the CPU and GPU by providing both the CPU and the GPU with thesame virtual memory and the same physical memory. In embodiments, thephysical memory may be partitioned between the CPU and the GPU. Further,the physical memory can be a paged system memory that is allocated bythe operating system of the computing device. Additionally, in someembodiments, the CPU and GPU are physically located on the same die.Thus, the CPU and the GPU may share the data contained within thephysical memory without copying data from the address space of the GPUto the address space of the CPU, or vice versa. This may reduce the costof offloading computational tasks from the CPU to the GPU by, forexample, decreasing the time and the power consumption for sharing databetween the CPU and the GPU.

In the following description and claims, the terms “coupled” and“connected” along with their derivatives, may be used. It should beunderstood that these terms are not intended as synonyms for each other.Rather, in particular embodiments, “connected” may be used to indicatethat two or more elements are in direct physical or electrical contactwith each other. “Coupled” may mean that two or more elements are indirect physical or electrical contact. However, “coupled” may also meanthat two or more elements are not in direct contact with each other, butyet still co-operate or interact with each other.

Some embodiments may be implemented in one or a combination of hardware,firmware, and software. Some embodiments may also be implemented asinstructions stored on a machine-readable medium, which may be read andexecuted by a computing platform to perform the operations describedherein. A machine-readable medium may include any mechanism for storingor transmitting information in a form readable by a machine, e.g., acomputer. For example, a machine-readable medium may include read onlymemory (ROM); random access memory (RAM); magnetic disk storage media;optical storage media; flash memory devices; or electrical, optical,acoustical or other form of propagated signals, e.g., carrier waves,infrared signals, digital signals, or the interfaces that transmitand/or receive signals, among others.

An embodiment is an implementation or example. Reference in thespecification to “an embodiment,” “one embodiment,” “some embodiments,”“various embodiments,” or “other embodiments” means that a particularfeature, structure, or characteristic described in connection with theembodiments is included in at least some embodiments, but notnecessarily all embodiments, of the inventions. The various appearancesof “an embodiment,” “one embodiment,” or “some embodiments” are notnecessarily all referring to the same embodiments. Elements or aspectsfrom an embodiment can be combined with elements or aspects of anotherembodiment.

Not all components, features, structures, characteristics, etc.described and illustrated herein need be included in a particularembodiment or embodiments. If the specification states a component,feature, structure, or characteristic “may”, “might”, “can” or “could”be included, for example, that particular component, feature, structure,or characteristic is not required to be included. If the specificationor claim refers to “a” or “an” element, that does not mean there is onlyone of the element. If the specification or claims refer to “anadditional” element, that does not preclude there being more than one ofthe additional element.

It is to be noted that, although some embodiments have been described inreference to particular implementations, other implementations arepossible according to some embodiments. Additionally, the arrangementand/or order of circuit elements or other features illustrated in thedrawings and/or described herein need not be arranged in the particularway illustrated and described. Many other arrangements are possibleaccording to some embodiments.

In each system shown in a figure, the elements in some cases may eachhave a same reference number or a different reference number to suggestthat the elements represented could be different and/or similar.However, an element may be flexible enough to have differentimplementations and work with some or all of the systems shown ordescribed herein. The various elements shown in the figures may be thesame or different. Which one is referred to as a first element and whichis called a second element is arbitrary.

FIG. 1 is a block diagram of a computing device 100 that may be used inaccordance with embodiments. The computing device 100 may be, forexample, a laptop computer, desktop computer, tablet computer, mobiledevice, or server, among others. The computing device 100 may include acentral processing unit (CPU) 102 that is adapted to execute storedinstructions, as well as a memory device 104 that stores instructionsthat are executable by the CPU 102. The CPU may be coupled to the memorydevice 104 by a bus 106. Additionally, the CPU 102 can be a single coreprocessor, a multi-core processor, a computing cluster, or any number ofother configurations. Furthermore, the computing device 100 may includemore than one CPU 102. The instructions that are executed by the CPU 102may be used to implement shared virtual memory.

The computing device 100 may also include a graphics processing unit(GPU) 108. The GPU 108 is an input/output device within the computingdevice 100. As shown, the CPU 102 may be coupled through the bus 106 tothe GPU 108. However, in some embodiments, the GPU 108 is located on thesame die as the CPU 102 within the computing device 100. In this manner,the CPU 102 and the GPU are physically connected such that theconnection between the CPU 102 and the GPU 108 via the bus 106 may beeliminated. Furthermore, in embodiments, the CPU 102 and the GPU 108 maybe included within a unified memory architecture of the computing device100, as discussed with respect to FIG. 2.

The GPU 108 may be configured to perform any number of graphicsoperations within the computing device 100. For example, the GPU 108 maybe configured to render or manipulate graphics images, graphics frames,videos, or the like, to be displayed to a user of the computing device100. In some embodiments, the GPU 108 includes a number of graphicsengines (not shown), wherein each graphics engine is configured toperform specific graphics tasks, or to execute specific types ofworkloads.

The memory device 104 can include random access memory (RAM), read onlymemory (ROM), flash memory, or any other suitable memory systems. Forexample, the memory device 104 may include dynamic random access memory(DRAM). The memory device 104 may include a device driver 110 that isconfigured to execute the instructions for implementing shared virtualmemory. The device driver 110 may be software, an application program,application code, or the like. In some embodiments, the device driver110 is a user mode driver.

The memory device 104 also includes a multilevel 112 cache that includesa last level cache (LLC) 114, a level 2 cache 116, and a level 1 cache118. Although a multi-level cache 112 is used for illustration, anycache can be included in the computing device 100. The multi-level cache112 may be a smaller, faster memory that stores a smaller subset offrequently used data for the CPU 102. A larger data set may be stored ina storage device 120. The storage device 120 is a physical memory suchas a hard drive, an optical drive, a thumbdrive, an array of drives, orany combinations thereof. The storage device 120 may also include remotestorage drives. The amount of time for the CPU 102 to access data storedin the storage device 120 may be slower relative to the amount of timeit takes for the CPU 102 to access the multi-level cache 112 in thememory 104.

In some embodiments, the LLC 114 is shared between the CPU 102 and theGPU 108, while the level 2 cache 116 and the level 1 cache 118 may behidden from the GPU 108 such that the GPU 108 cannot directly accessdata cached in the level 2 cache 116 and the level 1 cache 118. However,the LLC 114 can read and write data stored in the level 2 cache 116 andthe level 1 cache 118. Thereby, when the GPU 108 requests data cached inthe level 2 cache 116 or the level 1 cache 118, the LLC 114 is able toretrieve data from the level 2 cache 116 and the level 1 cache 118 forprocessing by the GPU 108. In this manner, the LLC 114 ensures datacoherency within the computing device 100. As used herein, coherencyrefers to the state wherein the data being accessed by the CPU 102 andthe GPU 108 is the same. Accordingly, the CPU 102 will ensure that datafrom the storage device 120 is accurately reflected in the LLC 114, thelevel 2 cache 116, and the level 1 cache 118 by ensuring the data iscoherent with the LLC 114 in order to enable the correct data to beshared with the GPU 108.

Additionally, in embodiments, the CPU and GPU can access any level ofmemory. However, data from other levels of memory may be stale, whilethe LLC 114 includes the most recent data. Furthermore, in embodiments,the CPU and GPU can employ any mutually accessible storage location toperform shared virtual memory. Any mutually accessible storage locationmay include, but is not limited to, any area of the memory device 104,any area of the storage 120, a networked storage location, a thumbdrive,or any combination thereof.

The storage device 120 includes a surface 122 as well as any number ofapplications 124 that are configured to run on the computing device 100.The surface 122 is a designated portion of physical memory that isallocated by the device driver 110. The surface may be updated based onprocessing performed on the contents of the physical memory within thesurface 122. In embodiments, when an application 124 is executed by CPU104, the application 124 may request that a surface be allocated by thedevice driver 110. Furthermore, the applications 124 running on the CPU102 may configure the surface 122 depending on the memory allocationcalled for by the applications 124 by specifying the desired size andcharacteristics of the surface 122. Additionally, surface allocation maybe performed, for example, in response to input from the CPU 102 of thecomputing device 100. Furthermore, in embodiments, the surface is markedas LLC cacheable. By designated the surface 122 as LLC cacheable, thedata cached from locations within the surface 122 may be cached to theLLC 114, and thereby accessible in the LLC by both the CPU 102 and theGPU 108.

In embodiments, the device driver informs a kernel mode driver that thesurface will be a shared virtual memory surface. The kernel mode driverwill save the CPU virtual memory addresses for the surface. When thekernel mode driver pages the surface into graphics memory, the kernelmode driver may reroute the paging from the original graphics virtualaddresses to graphics virtual addresses that are equal to the CPUaddress. Additionally, in embodiments, the virtual graphics address is aprivate graphics address space that belongs solely to the givenapplication.

A memory management unit (MMU) 126 may be used to manage access to datathat is stored within the surface 122. The MMU 126 can divide thevirtual address space of the CPU 102 and the GPU 108 into various pagesof address space. The CPU 102 and the GPU 108 each have identicalvirtual address spaces. The virtual address space allows for protectionof the data contained within the surface 122 by isolating the variousapplications 124 executing within a computing system to a particularsubset of virtual addresses. Through the use of virtual address spaces,one application 124 will not access the data of another application 124.Accordingly, the MMU 126 includes a CPU page table 128 and a GPU pagetable 130. The CPU page table contains the virtual addresses of the CPUmapped to a physical address location within the surface 122. Similarly,the GPU page table contains the virtual addresses of the GPU mapped to aphysical address location within the surface 122. The virtual addressesof the GPU are equivalent to the virtual addresses of the CPU. Thus, inthe shared virtual memory procedure described herein, the CPU page table128 may include a mapping of the CPU virtual address space to a physicaladdress space. The physical address space corresponds to physicallocations within the surface 122. Likewise, the GPU page table 130 mayinclude a mapping of the GPU virtual address space to the same physicaladdress space.

In various embodiments, the virtual memory addresses from the CPU pagetable 128 and the graphics virtual memory addresses from the GPU pagetable 130 are mapped to the physical memory pages of the surface 122 viaa translation procedure. The translation procedure may be used toconvert any of the virtual memory addresses to a corresponding physicaladdress. For example, the translation procedure may be performed via apage table walk, which may be performed based on a specific translationtable for converting virtual memory addresses within a page table tophysical memory addresses within the page table. Additionally, inembodiments, a translation look-aside buffer may be used to translatethe virtual addresses of the CPU and the GPU into physical addressspaces within their respective page tables.

After a translation or conversion procedure has been performed, thesurface 122 may be pinned. Pinning the surface refers to protecting thesurface so that the physical locations and the corresponding physicaladdresses are unchanged. Thus, pinning the surface 122 ensures a “hard”mapping between virtual address spaces and physical address spaces. Thehard mapping between address spaces is a mapping that does not changeafter the surface has been pinned. If the surface is not pinned, a pagefault may be generated, or the wrong data may be processed as thephysical location of the surface may shift.

In embodiments, an application 124 may execute on the CPU 102, andrequest a surface, such as the surface 122, in order to perform theoperations, such as processing data. The CPU 102 may handoff theoperations to the GPU 108. Since the both virtual memories areequivalent and the page tables have been mapped to the surface 122, theGPU can begin immediate execution of the operations that have beenoffloaded by the CPU 102 by accessing the surface, without copying dataover to another address space. Further, the data does not need to berestructured. When the operations are completed by the CPU 102, the GPU108 may signal to the CPU 122 that the operations are complete. The CPU102 may then continue processing the data, without copying the data backto an original address space.

When the operations that are requested by the application 124 areperformed by the GPU 108, modifications to the surface 122 may occur.According to the shared virtual memory procedure described herein, suchmodifications to the surface 122 are fully visible to the CPU 102. Thus,data may be shared between the GPU 108 and the CPU 102 without copyingthe data from the GPU 108 to the CPU 102, or vice versa.

The CPU 102 may be connected through the bus 106 to an input/output(I/O) device interface 132 adapted to connect the computing device 100to one or more I/O devices 134. The I/O devices 134 may include, forexample, a keyboard and a pointing device, wherein the pointing devicemay include a touchpad or a touchscreen, among others. The I/O devices134 may be built-in components of the computing device 100, or may bedevices that are externally connected to the computing device 100.

The CPU 102 may also be linked through the bus 106 to a displayinterface 136 adapted to connect the computing device 100 to a displaydevice 138. The display device 138 may include a display screen that isa built-in component of the computing device 100. The display device 138may also include a computer monitor, television, or projector, amongothers, that is externally connected to the computing device 100.

A network interface controller (NIC) 140 may be adapted to connect thecomputing device 100 through the bus 106 to a network 142. The network142 may be a wide area network (WAN), local area network (LAN), or theInternet, among others.

The block diagram of FIG. 1 is not intended to indicate that thecomputing device 100 is to include all of the components shown inFIG. 1. Further, the computing device 100 may include any number ofadditional components not shown in FIG. 1, depending on the details ofthe specific implementation.

FIGS. 2A and 2B are a schematic of a unified memory architecture 200that may be used to implement shared virtual memory between the CPU 102and the GPU 108 of the computing device 100, in accordance withembodiments. Like numbered items are as described with respect toFIG. 1. The UMA 200 may include, for example, the CPU page table 128,the GPU page table 130, and the surface 122 of the computing device 100.

The UMA 200 may enable shared virtual memory between the CPU 102 and theGPU 108 without any type of data copying between the CPU 102 and the GPU108. Further, no data restructuring or compiler configuration occurs.This may be accomplished by allowing the CPU 102 and the GPU 108 toshare the surface 122 and have equivalent virtual addresses in theirrespective page tables. As described above, the surface 122 may be aportion of a physical storage device. The surface includes any number ofphysical memory locations 202. The physical memory locations 202 may beorganized into a paged memory format, where a page is a fixed-lengthblock of physical memory within the surface 122.

The CPU page table 128 may include a number of CPU virtual memoryaddresses 204, and the GPU page table 130 may also include a number ofgraphics virtual memory addresses 204. The CPU virtual memory addresses204 make up the CPU virtual address space, while the graphics virtualmemory addresses 204 make up the graphics virtual address space. Eachvirtual address space is mapped to a physical address 206 in each pagetable. Thus, the CPU virtual memory addresses 204 and the graphicsvirtual memory addresses 204 both map to the same set of physicaladdresses 206 within the CPU page table 128 and the GPU page table 130,respectively.

The physical addresses 206 enable the CPU 102 and the GPU 108 (FIG. 1)to process data stored at physical locations 202 within the surface 122.In various embodiments, the surface 122 is allocated based on thespecific CPU virtual addresses 204 accessed by an application, such asan application 124 (FIG. 1). Once the surface 122 has been allocated,each physical address 208 is mapped to a corresponding CPU virtualaddress 204 within the CPU page table 128, as shown in FIG. 2. The CPUvirtual addresses 204 for the surface 122 are shared with the graphicsmemory. The surface 122 may be paged into graphics memory when acomputational task of an application 124 (FIG. 1) is offloaded to theGPU 108. As the surface 122 is paged into the graphics memory, the pagewill be rerouted from the original graphics virtual addresses to thegraphics virtual addresses 206 that are equal to the CPU virtualaddresses 204. The GPU virtual graphics address space is a privategraphics address space that belongs solely to the given application.

The graphics virtual memory addresses 204 within the GPU page table 130may be synchronized with the CPU page table 128, such that the CPUvirtual addresses and the GPU virtual memory addresses are mapped to thesame set of physical addresses 206. The physical addresses 206correspond to physical locations 202 within the surface 122.Accordingly, the surface 122 may be directly shared between the CPU 102and the GPU 108. In embodiments, if the GPU 108 modifies data located atany of physical locations 202, the modifications are automaticallyvisible to the CPU 102 via the surface 122 without any data copying ordata marshaling.

The schematic of FIG. 2 is not intended to indicate that the UMA 200 isto include all of the components shown in FIG. 2. Further, the UMA 200may include any number of additional components not shown in FIG. 2,depending on the details of the specific implementation.

FIG. 3 is a process flow diagram showing a method 300 for shared virtualmemory between the CPU and the GPU of a computing device, in accordancewith embodiments. In various embodiments, the method 300 is used toshare memory between the CPU and the GPU without copying data from a CPUmemory to a GPU memory.

In some embodiments, the method 300 may be executed on a computingdevice, such as the computing device 100 where the CPU 102 and the GPU108 are connected by a bus 106. In other embodiments, the CPU 102 andthe GPU 108 may be included in a UMA, such as the UMA 200 discussedabove with respect to FIG. 2. Further, the method 300 may executed by adriver of the computing device, such as the device driver 126 of thecomputing device 100.

The method begins at block 302 with the allocation of a surface within aphysical memory. In embodiments, the surface may be allocated within thephysical memory of a computing device in response to input from anapplication running on the CPU of the computing device. Furthermore, inembodiments, the surface may be allocated by the device driver. Thesurface may also be marked as a shared virtual memory surface. Theapplication or the device driver may access the surface from the CPUusing a CPU virtual address. In embodiments, the CPU virtual addressesare provided to the application or the device driver by an operatingsystem of the computing device.

At block 304, a CPU virtual address space is created based on thesurface. In embodiments, the CPU address space is generated at therequest of an application. At block 306, the surface is mapped to theCPU virtual address space. The mapping between the CPU virtual memoryaddresses and the physical addresses are included within a CPU pagetable.

At block 308, a GPU virtual address space is created that is equivalentto the CPU virtual address space. At block 310, the surface is mapped tothe CPU virtual address space. In embodiments, mapping the physicalmemory pages to the virtual memory addresses may include translating orconverting the virtual addresses to determine corresponding physicalmemory pages within the system memory. When the virtual addresses havebeen translated or converted to physical addresses, the associationsbetween the virtual addresses and the physical addresses found duringthe translation process are locked. By locking the associations, thephysical locations of the surface that correspond to the physicaladdresses in the page tables may be paged in to the cache. The pageswill remain in the cache while the associations are locked, as thephysical addresses of the surface are prevented from changing by thedevice driver.

In embodiments, the surface is designated as LLC cacheable. Such adesignation ensures that the physical locations of the surface arecached into the LLC which is shared by the CPU and the GPU. The graphicsvirtual memory addresses used by the application may be translated tothe same physical addresses that are mapped to the virtual addresses ofthe CPU. In embodiments, the device driver may update the mapping ofgraphics virtual memory addresses to the physical addresses within theGPU page table.

At block 312, the surface is pinned. By pinning the surface, thephysical locations within the surface are prevented from being changed.For example, an operating system may change physical locations as a partof its memory management. However, once the surface has been pinned, theoperating system is prevented from changing the physical locations ofthe surface.

FIG. 4 is a process flow diagram showing a method 400 for processingshared memory between the CPU and the GPU of a computing device, inaccordance with embodiments.

At block 402, an operation may be offloaded from the CPU to the GPU. Theoperation may be offloaded to the GPU as directed by an application,such as the application 124 (FIG. 1). Additionally, any applicationprogramming interface (API) used to control the CPU or the GPU may beused to direct the offloading of an operation from the CPU to the GPU.In embodiments, prior to offloading an operation from the CPU to theGPU, the any data located within the surface that is being processed bythe CPU may be made coherent with the LLC.

At block 404, the GPU may begin processing of the offloaded operation.The GPU accesses data within the LLC and the surface in order to performthe operation. In the event that the GPU requests data that is not inthe LLC but is in some other cache of the CPU, the LLC may retrieve thedata from the other cache for processing by the GPU.

At block 406, the GPU signals that the operation is complete. Thecompletion signal may be sent to the host. In embodiments, when theoperation is complete, the device driver synchronizes the operationbetween the GPU and the CPU. Further, in embodiments, the completionsignal may be, for example, a mailbox write or an interrupt. Thecompletion signal may indicate that the GPU has performed somecomputation or graphics operation that has resulted in a modification ofthe data within the surface. After completion, the output of the GPU maybe processed by the CPU. In various embodiments, when the GPU processesthe surface by reading from or writing to any of the physical locationsof the surface, processing may occur in internal buffers and caches ofthe GPU. Accordingly, the data within the internal buffers and caches ofthe GPU is coherent with the LLC after the GPU processing has completed.

The process flow diagram of FIGS. 3 and 4 are not intended to indicatethat the blocks of methods 300 and 400 are to be executed in anyparticular order, or that all of the blocks are to be included in everycase. Further, any number of additional blocks may be included withinthe methods 300 and 400, depending on the details of the specificimplementation. Additionally, while the methods described herein includea GPU, the memory may be shared between any I/O device such as anotherCPU or a direct memory access (DMA) controller.

FIG. 5 is a block diagram showing tangible, non-transitorycomputer-readable media 500 that stores code for shared virtual memorybetween the CPU and the GPU of a computing device, in accordance withembodiments. The tangible, non-transitory computer-readable media 500may be accessed by a processor 502 over a computer bus 504. Furthermore,the tangible, non-transitory computer-readable media 500 may includecode configured to direct the processor 502 to perform the methodsdescribed herein.

The various software components discussed herein may be stored on thetangible, non-transitory computer-readable media 500, as indicated inFIG. 5. For example, a surface allocation module 506 may be configuredto allocate a surface including a number of physical memory pages withina memory of the computing device. A virtualization module 508 may createa CPU virtual address space and GPU virtual address space equivalent tothe CPU virtual address space. The GPU virtual address space may becreated when the surface is paged into the graphics memory. A mappingmodule 510 may be configured to map the physical locations within thesurface to virtual memory addresses within the CPU address table and GPUaddress table. Further, a pinning module 512 may be configured to pinthe surface so that the physical locations within the surface areprevented from changing.

The block diagram of FIG. 5 is not intended to indicate that thetangible, non-transitory computer-readable media 500 is to include allof the components shown in FIG. 5. Further, the tangible, non-transitorycomputer-readable media 500 may include any number of additionalcomponents not shown in FIG. 5, depending on the details of the specificimplementation.

FIG. 6 is a block diagram of an exemplary system 600 for implementingshared physical memory. Like numbered items are as described withrespect to FIGS. 1, 2A, and 2B. In some embodiments, the system 600 is amedia system. In addition, the system 600 may be incorporated into apersonal computer (PC), laptop computer, ultra-laptop computer, tablet,touch pad, portable computer, handheld computer, palmtop computer,personal digital assistant (PDA), cellular telephone, combinationcellular telephone/PDA, television, smart device (e.g., smart phone,smart tablet or smart television), mobile internet device (MID),messaging device, data communication device, or the like.

In various embodiments, the system 600 comprises a platform 602 coupledto a display 604. The platform 602 may receive content from a contentdevice, such as content services device(s) 606 or content deliverydevice(s) 608, or other similar content sources. A navigation controller610 including one or more navigation features may be used to interactwith, for example, the platform 602 and/or the display 604. Each ofthese components is described in more detail below.

The platform 602 may include any combination of a chipset 612, a centralprocessing unit (CPU) 102, a memory device 104, a storage device 120, agraphics subsystem 614, applications 124, and a radio 616. The chipset612 may provide intercommunication among the CPU 102, the memory device104, the storage device 120, the graphics subsystem 614, theapplications 124, and the radio 614. For example, the chipset 612 mayinclude a storage adapter (not shown) capable of providingintercommunication with the storage device 120.

The CPU 102 may be implemented as Complex Instruction Set Computer(CISC) or Reduced Instruction Set Computer (RISC) processors, ×86instruction set compatible processors, multi-core, or any othermicroprocessor or central processing unit (CPU). In some embodiments,the CPU 102 includes dual-core processor(s), dual-core mobileprocessor(s), or the like.

The memory device 104 may be implemented as a volatile memory devicesuch as, but not limited to, a Random Access Memory (RAM), DynamicRandom Access Memory (DRAM), or Static RAM (SRAM). The storage device120 may be implemented as a non-volatile storage device such as, but notlimited to, a magnetic disk drive, optical disk drive, tape drive, aninternal storage device, an attached storage device, flash memory,battery backed-up SDRAM (synchronous DRAM), and/or a network accessiblestorage device. In some embodiments, the storage device 120 includestechnology to increase the storage performance enhanced protection forvaluable digital media when multiple hard drives are included, forexample.

The graphics subsystem 614 may perform processing of images such asstill or video for display. The graphics subsystem 614 may include agraphics processing unit (GPU), such as the GPU 108, or a visualprocessing unit (VPU), for example. An analog or digital interface maybe used to communicatively couple the graphics subsystem 614 and thedisplay 604. For example, the interface may be any of a High-DefinitionMultimedia Interface, DisplayPort, wireless HDMI, and/or wireless HDcompliant techniques. The graphics subsystem 614 may be integrated intothe CPU 102 or the chipset 612. Alternatively, the graphics subsystem614 may be a stand-alone card communicatively coupled to the chipset612.

The graphics and/or video processing techniques described herein may beimplemented in various hardware architectures. For example, graphicsand/or video functionality may be integrated within the chipset 612.Alternatively, a discrete graphics and/or video processor may be used.As still another embodiment, the graphics and/or video functions may beimplemented by a general purpose processor, including a multi-coreprocessor. In a further embodiment, the functions may be implemented ina consumer electronics device.

The radio 616 may include one or more radios capable of transmitting andreceiving signals using various suitable wireless communicationstechniques. Such techniques may involve communications across one ormore wireless networks. Exemplary wireless networks include wirelesslocal area networks (WLANs), wireless personal area networks (WPANs),wireless metropolitan area network (WMANs), cellular networks, satellitenetworks, or the like. In communicating across such networks, the radio616 may operate in accordance with one or more applicable standards inany version.

The display 604 may include any television type monitor or display. Forexample, the display 604 may include a computer display screen, touchscreen display, video monitor, television, or the like. The display 604may be digital and/or analog. In some embodiments, the display 604 is aholographic display. Also, the display 604 may be a transparent surfacethat may receive a visual projection. Such projections may conveyvarious forms of information, images, objects, or the like. For example,such projections may be a visual overlay for a mobile augmented reality(MAR) application. Under the control of one or more applications 124,the platform 602 may display a user interface 618 on the display 604.

The content services device(s) 606 may be hosted by any national,international, or independent service and, thus, may be accessible tothe platform 602 via the Internet, for example. The content servicesdevice(s) 606 may be coupled to the platform 602 and/or to the display604. The platform 602 and/or the content services device(s) 606 may becoupled to a network 142 to communicate (e.g., send and/or receive)media information to and from the network 142. The content deliverydevice(s) 608 also may be coupled to the platform 602 and/or to thedisplay 604.

The content services device(s) 606 may include a cable television box,personal computer, network, telephone, or Internet-enabled devicecapable of delivering digital information. In addition, the contentservices device(s) 606 may include any other similar devices capable ofunidirectionally or bidirectionally communicating content betweencontent providers and the platform 602 or the display 604, via thenetwork 142 or directly. It will be appreciated that the content may becommunicated unidirectionally and/or bidirectionally to and from any oneof the components in the system 600 and a content provider via thenetwork 142. Examples of content may include any media informationincluding, for example, video, music, medical and gaming information,and so forth.

The content services device(s) 606 may receive content such as cabletelevision programming including media information, digital information,or other content. Examples of content providers may include any cable orsatellite television or radio or Internet content providers, amongothers.

In some embodiments, the platform 602 receives control signals from thenavigation controller 610, which includes one or more navigationfeatures. The navigation features of the navigation controller 610 maybe used to interact with the user interface 618, for example. Thenavigation controller 610 may be a pointing device that may be acomputer hardware component (specifically human interface device) thatallows a user to input spatial (e.g., continuous and multi-dimensional)data into a computer. Many systems such as graphical user interfaces(GUI), and televisions and monitors allow the user to control andprovide data to the computer or television using physical gestures.Physical gestures include but are not limited to facial expressions,facial movements, movement of various limbs, body movements, bodylanguage or any combination thereof. Such physical gestures can berecognized and translated into commands or instructions.

Movements of the navigation features of the navigation controller 610may be echoed on the display 604 by movements of a pointer, cursor,focus ring, or other visual indicators displayed on the display 604. Forexample, under the control of the applications 124, the navigationfeatures located on the navigation controller 610 may be mapped tovirtual navigation features displayed on the user interface 618. In someembodiments, the navigation controller 610 may not be a separatecomponent but, rather, may be integrated into the platform 602 and/orthe display 604.

The system 600 may include drivers (not shown) that include technologyto enable users to instantly turn on and off the platform 602 with thetouch of a button after initial boot-up, when enabled, for example.Program logic may allow the platform 602 to stream content to mediaadaptors or other content services device(s) 606 or content deliverydevice(s) 608 when the platform is turned “off.” In addition, thechipset 612 may include hardware and/or software support for 5.1surround sound audio and/or high definition 7.1 surround sound audio,for example. The drivers may include a graphics driver for integratedgraphics platforms. In some embodiments, the graphics driver includes aperipheral component interconnect express (PCIe) graphics card.

In various embodiments, any one or more of the components shown in thesystem 600 may be integrated. For example, the platform 602 and thecontent services device(s) 606 may be integrated; the platform 602 andthe content delivery device(s) 608 may be integrated; or the platform602, the content services device(s) 606, and the content deliverydevice(s) 608 may be integrated. In some embodiments, the platform 602and the display 604 are an integrated unit. The display 604 and thecontent service device(s) 606 may be integrated, or the display 604 andthe content delivery device(s) 608 may be integrated, for example.

The system 600 may be implemented as a wireless system or a wiredsystem. When implemented as a wireless system, the system 600 mayinclude components and interfaces suitable for communicating over awireless shared media, such as one or more antennas, transmitters,receivers, transceivers, amplifiers, filters, control logic, and soforth. An example of wireless shared media may include portions of awireless spectrum, such as the RF spectrum. When implemented as a wiredsystem, the system 600 may include components and interfaces suitablefor communicating over wired communications media, such as input/output(I/O) adapters, physical connectors to connect the I/O adapter with acorresponding wired communications medium, a network interface card(NIC), disc controller, video controller, audio controller, or the like.Examples of wired communications media may include a wire, cable, metalleads, printed circuit board (PCB), backplane, switch fabric,semiconductor material, twisted-pair wire, co-axial cable, fiber optics,or the like.

The platform 602 may establish one or more logical or physical channelsto communicate information. The information may include mediainformation and control information. Media information may refer to anydata representing content meant for a user. Examples of content mayinclude, for example, data from a voice conversation, videoconference,streaming video, electronic mail (email) message, voice mail message,alphanumeric symbols, graphics, image, video, text, and the like. Datafrom a voice conversation may be, for example, speech information,silence periods, background noise, comfort noise, tones, and the like.Control information may refer to any data representing commands,instructions or control words meant for an automated system. Forexample, control information may be used to route media informationthrough a system, or instruct a node to process the media information ina predetermined manner. The embodiments, however, are not limited to theelements or the context shown or described in FIG. 6.

FIG. 7 is a schematic of a small form factor device 700 in which thesystem 600 of FIG. 6 may be embodied. Like numbered items are asdescribed with respect to FIG. 6. In some embodiments, for example, thedevice 700 is implemented as a mobile computing device having wirelesscapabilities. A mobile computing device may refer to any device having aprocessing system and a mobile power source or supply, such as one ormore batteries, for example.

As described above, examples of a mobile computing device may include apersonal computer (PC), laptop computer, ultra-laptop computer, tablet,touch pad, portable computer, handheld computer, palmtop computer,personal digital assistant (PDA), cellular telephone, combinationcellular telephone/PDA, television, smart device (e.g., smart phone,smart tablet or smart television), mobile internet device (MID),messaging device, data communication device, and the like.

An example of a mobile computing device may also include a computer thatis arranged to be worn by a person, such as a wrist computer, fingercomputer, ring computer, eyeglass computer, belt-clip computer, arm-bandcomputer, shoe computer, clothing computer, or any other suitable typeof wearable computer. For example, the mobile computing device may beimplemented as a smart phone capable of executing computer applications,as well as voice communications and/or data communications. Althoughsome embodiments may be described with a mobile computing deviceimplemented as a smart phone by way of example, it may be appreciatedthat other embodiments may be implemented using other wireless mobilecomputing devices as well.

As shown in FIG. 7, the device 700 may include a housing 702, a display704, an input/output (I/O) device 706, and an antenna 708. The device700 may also include navigation features 710. The display 704 mayinclude any suitable display unit for displaying information appropriatefor a mobile computing device. The I/O device 706 may include anysuitable I/O device for entering information into a mobile computingdevice. For example, the I/O device 706 may include an alphanumerickeyboard, a numeric keypad, a touch pad, input keys, buttons, switches,rocker switches, microphones, speakers, a voice recognition device andsoftware, or the like. Information may also be entered into the device700 by way of microphone. Such information may be digitized by a voicerecognition device

EXAMPLE 1

A method for shared virtual memory between a central processing unit(CPU) and a graphics processing unit (GPU) of a computing device isdescribed herein. The method includes allocating a surface within aphysical memory. A CPU virtual address space may be created, and thesurface may be mapped to the CPU virtual address space within a CPU pagetable. The method also includes creating a GPU virtual address spaceequivalent to the CPU virtual address space, and mapping the surface tothe GPU virtual address space within a GPU page table. The method alsoincludes pinning the surface.

Memory may be shared between the CPU and the GPU via the surface withoutcopying data from a CPU memory to a GPU memory. The surface may beallocated in response to input from an application running on the CPU ofthe computing device. In addition, the method may be executed by adriver of the computing device.

Data from the cache of the CPU and the GPU may be coherent with a lastlevel cache (LLC) that is shared between the CPU and the GPU. Anoperation may be offloaded from the CPU to the GPU, and the operationmay be performed within the GPU. A completion signal may be sent to theCPU, wherein the completion signal includes an indication that the GPUhas performed some computation that has resulted in a modification ofdata within the surface. Additionally, a device driver may synchronizethe processing of data between the CPU and the GPU.

EXAMPLE 2

A computing device is described herein. The computing device includes acentral processing unit (CPU) that is adapted to execute storedinstructions and a storage device that stores instructions. The storagedevice includes processor executable code that, when executed by theCPU, is adapted to allocate a surface within a physical memory. A CPUvirtual address space may be created, and the surface may be mapped tothe CPU virtual address space within a CPU page table. Additionally, aGPU virtual address space equivalent to the CPU virtual address spacemay be created, and the surface may be mapped to the GPU virtual addressspace within a GPU page table. The processor executable code may also beadapted to pin the surface.

The physical memory may be shared between the CPU and the GPU withoutcopying data from a CPU memory to a GPU memory. Further, the CPU and theGPU are located on a same die within the computing device. The CPU andthe GPU may share a last level cache (LLC), wherein the LLC can retrievedata from any cache of the CPU or GPU. The CPU and the GPU may include aunified memory architecture (UMA).

The processor executable code may be adapted to allocate the surface inresponse to input from an application running on the CPU of thecomputing device. The virtual memory addresses in the CPU page table andthe GPU page table may be mapped to physical locations within thesurface by converting the virtual addresses to physical addresses. Adriver may be configured to initiate execution of the processorexecutable code. Additionally, the computing device may include a radioand a display, and the radio and display may be communicatively coupledat least to the central processing unit.

EXAMPLE 3

At least one non-transitory machine readable medium having instructionsstored therein is described herein. In response to being executed on acomputing device, the instructions cause the computing device toallocate a surface within a physical memory, A CPU virtual address spacemay be generated, and the surface may be mapped to the CPU virtualaddress space within a CPU page table. The instructions may alsogenerate a GPU virtual address space equivalent to the CPU virtualaddress space, and map the surface to the GPU virtual address spacewithin the GPU page table. Additionally, the surface is pinned.

The physical memory may be shared between the CPU and the GPU withoutcopying data from a CPU memory to a GPU memory. Further, theinstructions may cause the data from a cache of the CPU and a cache ofthe GPU to be coherent with a last level cache (LLC). In addition, theinstructions may also cause the computing device to allocate the surfacein response to input from an application running on a CPU of thecomputing device.

It is to be understood that specifics in the aforementioned examples maybe used anywhere in one or more embodiments. For instance, all optionalfeatures of the computing device described above may also be implementedwith respect to either of the methods or the computer-readable mediumdescribed herein. Furthermore, although flow diagrams and/or statediagrams may have been used herein to describe embodiments, theinventions are not limited to those diagrams or to correspondingdescriptions herein. For example, flow need not move through eachillustrated box or state or in exactly the same order as illustrated anddescribed herein

The inventions are not restricted to the particular details listedherein. Indeed, those skilled in the art having the benefit of thisdisclosure will appreciate that many other variations from the foregoingdescription and drawings may be made within the scope of the presentinventions. Accordingly, it is the following claims including anyamendments thereto that define the scope of the inventions.

What is claimed is:
 1. A method for shared virtual memory, comprising:allocating a surface within a physical memory, wherein the surface isdirectly shared between a CPU and a GPU and data on the surface isautomatically visible without copying data; creating a CPU virtualaddress space; mapping the surface to the CPU virtual address spacewithin a CPU page table; creating a GPU virtual address space equivalentto the CPU virtual address space; mapping the surface to the GPU virtualaddress space within a GPU page table; and pinning the surface.
 2. Themethod of claim 1, comprising sharing physical memory between the CPUand the GPU via the surface without copying data from a CPU memory to aGPU memory.
 3. The method of claim 1, comprising allocating the surfacein response to input from an application running on the CPU of thecomputing device.
 4. The method of claim 1, wherein the method isexecuted by a driver of the computing device.
 5. The method of claim 1,comprising ensuring data from a cache of the CPU and a cache of the GPUis coherent with a last level cache (LLC) that is shared between the CPUand the GPU.
 6. The method of claim 1, comprising: offloading anoperation from the CPU to the GPU; performing the operation within theGPU; and sending a completion signal to the CPU, wherein the completionsignal comprises an indication that the GPU has performed somecomputation that has resulted in a modification of data within thesurface.
 7. The method of claim 1, wherein a device driver synchronizesthe processing of data between the CPU and the GPU.
 8. The method ofclaim 1, comprising translating the CPU virtual address space and theGPU virtual address space to determine corresponding physical locationswithin the surface.
 9. A computing device, comprising: a centralprocessing unit (CPU) that is adapted to execute stored instructions; aGPU than includes a GPU page table; a storage device that storesinstructions, the storage device comprising processor executable codethat, when executed by the CPU, is adapted to: allocate a surface withina physical memory, wherein the surface is directly shared between theCPU and the GPU and data on the surface is automatically visible withoutcopying data; create a CPU virtual address space; map the surface to theCPU virtual address space within a CPU page table; create a GPU virtualaddress space equivalent to the CPU virtual address space; map thesurface to the GPU virtual address space within the GPU page table; andpin the surface.
 10. The computing device of claim 9, wherein the CPUand the GPU share physical memory without the processor executable codebeing configured to copy data from a CPU memory to a GPU memory.
 11. Thecomputing device of claim 9, wherein the CPU and the GPU are on a samedie within the computing device.
 12. The computing device of claim 9,wherein the CPU and the GPU share a last level cache (LLC), and whereinthe LLC retrieves data from any cache of the CPU or GPU.
 13. Thecomputing device of claim 9, wherein the CPU and the GPU comprise aunified memory architecture (UMA).
 14. The computing device of claim 9,wherein the processor executable code is adapted to allocate the surfacein response to input from an application running on the CPU of thecomputing device.
 15. The computing device of claim 9, wherein theprocessor executable code is configured to map the virtual memoryaddresses within the CPU page table and the GPU page table to physicallocations within the surface by conversion of the plurality of virtualmemory addresses within the CPU page table to physical addresses andconversion of the plurality of virtual memory addresses within the GPUpage table to physical addresses.
 16. The computing device of claim 9,comprising a driver configured to initiate execution of the processorexecutable code.
 17. The computing device of claim 9, further comprisinga radio and a display, the radio and display communicatively coupled atleast to the central processing unit.
 18. At least one non-transitorycomputer readable medium having instructions stored therein that, inresponse to being executed on a computing device, cause the computingdevice to: allocate a surface within a physical memory, wherein thesurface is directly shared between a CPU and a GPU and data on thesurface is automatically visible without copying data; generate a CPUvirtual address space; map the surface to the CPU virtual address spacewithin a CPU page table; generate a GPU virtual address space equivalentto the CPU virtual address space; map the surface to the GPU virtualaddress space within the GPU page table; and pin the surface.
 19. The atleast one non-transitory computer readable medium of claim 18, whereinthe physical memory is shared between the CPU and the GPU withoutcopying data from a CPU memory to a GPU memory.
 20. The at least onenon-transitory computer readable medium of claim 18, further comprisinginstructions stored thereon, which cause the computing device to: ensuredata from a cache of the CPU and a cache of the GPU is coherent with alast level cache (LLC).